<?php

use yii\grid\GridView;
use yii\widgets\ActiveForm;
use yii\widgets\LinkPager;
use common\helpers\Url;
use common\helpers\Html;

$this->title                   = '提现日志';
$this->params['breadcrumbs'][] = ['label' => $this->title];
?>

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>

                <div class="col-sm-12" style="margin-top: 10px;">
                    <?php $form = ActiveForm::begin([
                        'action' => Url::to(['log']),
                        'method' => 'get',
                    ]); ?>

                    <div class="col-sm-3">
                        <div class="input-group">

                            <?= Html::textInput('keyword', $keyword, [
                                'class' => 'form-control',
                                'id' => 'test-input',
                                'placeholder' => '请输入要查询的用户名',
                            ]) ?>

                            <span class="input-group-btn"><button class="btn btn-white"><i
                                            class="fa fa-search"></i> 搜索</button></span>

                        </div>
                    </div>

                    <?php ActiveForm::end(); ?>

                </div>

                <div class="box-tools">
                    <?= Html::a('我要提现', ['withdraw'], [
                        'class'       => 'btn btn-success btn-sm',
                        'data-toggle' => 'modal',
                        'data-target' => '#ajaxModalLg',
                    ]) ?>
                    <?= Html::a('提现管理', ['index'], [
                        'class'       => 'btn btn-primary btn-sm',
                    ]) ?>
                </div>
            </div>
            <div class="box-body table-responsive">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'filterModel'  => $searchModel,
                    //重新定义分页样式
                    'tableOptions' => ['class' => 'table table-hover'],
                    'columns'      => [
                        [
                            'class'   => 'yii\grid\SerialColumn',
                        ],
                        [
                            'label'     => '申请用户',
                            'attribute' => 'member_id',
                            'value'     => 'manager.username',
                            'filter'    => FALSE,
                        ],
                        [
                            'attribute' => 'money',
                            'filter'    => FALSE,
                        ],
                        [
                            'attribute' => 'created_at',
                            'filter'    => FALSE,
                        ],
                        [
                            'attribute' => 'updated_at',
                            'filter'    => FALSE,
                        ],
                        [
                            'attribute' => 'status',
                            'label' =>'审核状态',
                            'filter'    => Html::activeDropDownList($searchModel, 'status',
                                [1 => '已通过', -1 => '未通过'], [
                                    'prompt' => '全部',
                                    'class'  => 'form-control',
                                ]),
                            'value'     => function ($model) {
                                switch ($model->status) {
                                    case -1 :
                                        return '未通过';
                                    case 1:
                                        return '已通过';
                                }
                            },
                        ],
                    ],
                ]); ?>
            </div>
            <div class="box-footer">

            </div>
        </div>
    </div>
</div>